#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main()
{
    int n, k;
    vector<string> v;
    string ori;
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        string temp;
        cin >> temp;
        v.push_back(temp);
    }
    cin >> ori >> k;

    multiset<string> ss;
    string ori_temp = ori;
    sort(ori.begin(), ori.end());
    for (auto& x : v)
    {
        if (x == ori_temp) continue;
        string temp = x;
        sort(x.begin(), x.end());
        if (x == ori)
        {
            ss.insert(temp);
        }
    }
    cout << ss.size() << endl;
    if (ss.size() >= k)
    {
        auto it = ss.begin();
        while (--k)
        {
            ++it;
        }
        cout << *it << endl;
    }

    return 0;
}